<template>
    <div class="home_comtainer">
        <el-container>
            <el-container>
                <el-header height="132px">
                    <HomeHeader :userLogin="userLogin" :userChoosed="userChoosed"/>
                </el-header>
                <el-main>
                    <HomeMain :userLogin="userLogin" :userChoosed="userChoosed"/>
                </el-main>
            </el-container>
            <!-- <el-aside width="200px" style="margin-left:8px"></el-aside> -->

        </el-container>
    </div>
</template>

<script>
import HomeHeader from './HomeHeader';
import HomeMain from './HomeMain';
export default {
    name:'Home',
    components:{
        HomeHeader,
        HomeMain,
    },
    data(){
        return {
            userLogin:'',//当前用户id
            userChoosed:'',//查看的用户id
        }
    },
    created(){
        this.userLogin=this.$store.getters.user?this.$store.getters.user:{id:null};
        this.$axios.post('/api/users/getUser',{
            user:this.$route.params.id,
        })
        .then(res=>{
            this.userChoosed=res.data;
        })
    },
    watch:{
        $route(){
            this.userLogin=this.$store.getters.user?this.$store.getters.user:{id:null};
            this.$axios.post('/api/users/getUser',{
                user:this.$route.params.id,
            })
            .then(res=>{
                this.userChoosed=res.data;
            })
        }
    }
}
</script>

<style scoped>
.home_comtainer{
    width:100%;
    height:auto;
}
.el-header{
    padding:0 !important;
}
.el-main{
    padding:0 !important;
}
</style>

